/**
 * 元件,画图的最小单位
 */
import core from '../js/core'

/**
 * 图片元件
 */
class Img extends core.Element {
    static label = "图片"

    data = {
        src: "http://img7.daling.com/zin/2018/05/26/18/25/FA163E0BD2F9I5QI1XZP8MNR35I.jpg",
        w: 375,
        h: 300
    }
    tmpl = `<img class="elem" src="{{src}}" style="width:{{w}}px;height:{{h}}px;" />`;
    created(){
        $("img","#"+this.id).on("mousedown",function(e){
            e.preventDefault();
        });
    }
}

class Link extends core.Element {
    static label = "链接"

    data = {
        href: "http://www.baidu.com"
    }

    tmpl = `<a class="elem">链接:{{href}}</a>`;
}

export default function () {
    core.reg(Img);
    core.reg(Link);
}